﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
using System.Data.SqlClient;
namespace QuanLyThuoc.DAL
{
   public class NhomThuocDAL:KetNoiDAL
    {
       public DataTable SelectAll_NhomThuoc()
       {
           SqlCommand cmd = new SqlCommand("SelectAll_NhomThuoc", Connect());
           cmd.CommandType = CommandType.StoredProcedure;
           SqlDataAdapter da = new SqlDataAdapter(cmd);
           DataTable dt = new DataTable();
           da.Fill(dt);
           return dt;
       }
       public DataTable SelectID_NhomThuoc(string nhomthuoc)
       {
           SqlCommand cmd = new SqlCommand("SelectID_NhomThuoc", Connect());
           cmd.CommandType = CommandType.StoredProcedure;
           cmd.Parameters.AddWithValue("@NhomThuoc", nhomthuoc);
           SqlDataAdapter da = new SqlDataAdapter(cmd);
           DataTable dt = new DataTable();
           da.Fill(dt);
           return dt;
       }
       public int InsertNhomThuoc(string nhomthuoc)
       {
          
               SqlCommand cmd = new SqlCommand("Insert_NhomThuoc", Connect());
               cmd.CommandType = CommandType.StoredProcedure;
               cmd.Parameters.AddWithValue("@NhomThuoc", nhomthuoc);
              return cmd.ExecuteNonQuery();
          
       }
       public int UpdateNhomThuoc(string nhomthuoc)
       {
         
               SqlCommand cmd = new SqlCommand("Update_NhomThuoc", Connect());
               cmd.CommandType = CommandType.StoredProcedure;
               cmd.Parameters.AddWithValue("@NhomThuoc", nhomthuoc);
             return  cmd.ExecuteNonQuery();
           
       }
       public int DeleteNhomThuoc(string nhomthuoc)
       {
           
               SqlCommand cmd = new SqlCommand("Delete_NhomThuoc", Connect());
               cmd.CommandType = CommandType.StoredProcedure;
               cmd.Parameters.AddWithValue("@NhomThuoc", nhomthuoc);
             return  cmd.ExecuteNonQuery();
         
       }
    }
}
